<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="customer" tagdir="/WEB-INF/tags/customer"%>
<%@ taglib prefix="attribute" tagdir="/WEB-INF/tags/attribute"%>
<probiz:pageHeading entityName="${entityName}" entityHeadingKey="customerDetail.title" />
<content tag="buttons">
	<authorize:authorizeResource resourceString="/customer/customer/blank.html?doAction=save*">
		<probiz:iconBtn btnType="save" onclick="saveCustomer()" disabled="yes"/>
	</authorize:authorizeResource>
	<authorize:authorizeResource resourceString="/customer/customer/blank.html?doAction=*elete*">
		<probiz:iconBtn btnType="delete" onclick="deleteCustomer();" disabled="yes"/>
	</authorize:authorizeResource>
	<probiz:iconBtn btnType="back" onclick="returnToList();" />
	<c:if test="${not empty customer.appuserId}">
		<div class="line"></div>
		<authorize:authorizeResource resourceString="/customer/customer/blank.html?doAction=saveResetPassword*">
			<probiz:iconBtn btnType="resetPw" btnTextKey="button.resetPw" onclick="dlgresetPasswordDialog_show({appuserId:${customer.appuserId}})" />
		</authorize:authorizeResource>
	</c:if>
</content>
<div id="errorMsgExtraBar" class='warning_msg' style="display: none"/>
<div id="successMsgExtraBar" class="success_msg" style="display: none"/>
<probiz:showBindErrors bindPath="customer.*" />
<div class="top clearfix">
	<ul class="tab" id="detail">
		<c:choose>
			<c:when test="${empty customer.appuserId}">
				<li class="curr">
					<span><fmt:message key="customerDetail.tab.profile" />
					</span>
				</li>
			</c:when>
			<c:otherwise>
				<li class="curr">
					<a href="#tab-profile"><span><fmt:message key="customerDetail.tab.profile" /></span></a>
				</li>
				<li>
					<a href="#tab-salesOrder"><span><fmt:message key="customerDetail.tab.salesOrder" />(${salesOrderCount})</span></a>
				</li>
				<li>
					<a href="#tab-address"><span><fmt:message key="customerDetail.tab.address" />(${addressCount})</span></a>
				</li>
				<li>
					<a href="#tab-shopPoint"><span><fmt:message key="customerDetail.tab.shopPoint" /></span></a>
				</li>
				<li>
					<a href="#tab-review"><span><fmt:message key="customerDetail.tab.review" />(${reviewCount})</span></a>
				</li>
				<li>
					<a href="#tab-consult"><span><fmt:message key="customerDetail.tab.consult" />(${consultCount})</span></a>
				</li>
				<li>
					<a href="#tab-feedback"><span><fmt:message key="customerDetail.tab.feedback" />(${feedbackCount})</span></a>
				</li>
			</c:otherwise>
		</c:choose>
	</ul>
</div>

<div class="modify">
	<form class="mainForm" method="post" action="${ctxPath}/customer/customer/blank.html" id="customer">
		<c:choose>
			<c:when test="${empty customer.appuserId}">
				 <%@include file="include/customerFormProfile.jspf"%>
			</c:when>
			<c:otherwise>
				 <%@include file="include/customerFormProfile.jspf"%>
				 <div id="tab-salesOrder">
					 <%@include file="include/customerFormSalesOrder.jsp"%>
				 </div>
				 <div id="tab-address">
					 <%@include file="include/customerFormAddress.jsp"%>
				 </div>
				 <div id="tab-shopPoint">
					 <%@include file="include/customerFormShopPoint.jsp"%>
				 </div>
				 <div id="tab-review">
			 		<%@include file="include/customerFormReview.jsp"%>
				 </div>	
				 <div id="tab-consult">
					 <%@include file="include/customerFormConsult.jsp"%>
				</div>
				<div id="tab-feedback">
					 <%@include file="include/customerFormFeedback.jsp"%>
				</div>
			</c:otherwise>
		</c:choose>	
				
	</form>
</div>

<c:if test="${empty param.direct or !param.direct}">
	<c:set var="ui_tabs" value="true" scope="request"/>
	<c:set var="plugin_upload" value="true" scope="request"/>
	<c:set var="plugin_newUpload" value="true" scope="request"/>
	<c:set var="ui_datepicker_js" value="true" scope="request"/>
	<c:set var="ui_datepicker_zh_CN_js" value="true" scope="request"/>
</c:if>

<probiz:ui_tabs tabsId="detail" />
<v:javascript formName="customer" staticJavascript="false" />
<script type="text/javascript">
$j(document).ready(function () {
	displayButtons(${customer.status}); //显示操作按钮
	
	<%--用ajax方法load 主要为了解决页面加载开始时候处理太多js带来的ie加载速度太慢问题。--%>
	<c:if test="${not empty customer.appuserId}">
		fnOnGoToPageSalesOrder();
		fnOnGoToPageAddress();
		fnOnGoToPageShopPointHistory();
		fnOnGoToPageReview();
		fnOnGoToPageConsult();
		fnOnGoToPageFeedback();
	</c:if>
	
	applyValidate($j('#customer #password')[0],"required,minlength=6,maxlength=16");
	applyValidate($j('#customer #confirmPassword')[0],"required,minlength=6,maxlength=16");
	applyValidate($j('#mobilephone')[0],"mobile");
	//start:quickTip 生成 原因：在tag中$j无法扑捉到对象;另外直接用id指定是为了提高在ie下的查找速度
	$j('#addImagesBtn').each(function(){
      	$j(this).after('<img id="'+this.id+'_tip" width="14" height="14" src="'+__ctxPath+'/images/validate/info.gif"/>');
		$j('#'+this.id+'_tip').PQuickTip({
	         source:'text',
	         title:'Help',
	         type:'help',
	         text:$j(this).attr("quickTip")
      	});
	
	});
	//end:quickTip 生成
});
</script>


